function messageCount5(obj) {
    console.log(obj)
    let objID = obj.id

    bottomInit(objID)
    document.getElementById(objID).style.backgroundColor = "rgba(102,102,153,.8)"
    document.getElementById(objID).style.color = "rgb(255,255,255)"
    document.getElementById(objID).style.boxShadow = "0 0 0 white"
    document.getElementById(objID).style.border = "2px solid rgba(204,204,204,1)"
    let span = document.getElementById(objID).getElementsByTagName("span")
    for (const spanElement of span) {
        if (spanElement.getAttribute("name") === "badge") {
            spanElement.setAttribute("hidden","true")
        }
    }
    $("#messageCenterText0001").text("系统消息")

    $.post("/messageCenter/sysMessage",{},function (result) {
        console.log(result)
        let arr = [];
        let i = 0;
        for (const resultElement of result) {
            arr.push([resultElement.message,resultElement.day,resultElement.month,resultElement.hour,resultElement.messageType,(i+1)])
        }

        let newArr = duplicate2(arr)

        newArr.forEach((arr)=> {
            let month = arr[2]
            let day = arr[1]
            let hour = arr[3]
            let messageType = arr[4]

            i++;
            let message = arr[0]

            if (hour < 10) {
                hour = '0' + hour
            }

            let time = month+"月"+day+"日"+" " + hour + ":" + "00"

            var html = '<li class="NormalMessages" id="card_Li_0001'+i+'" style=" position: relative;margin-left: 6%;margin-top: 10px;height: 40px">'
                +'                         <span class="messageCenterText messageCenterText0001 NormalMessagesNum" id="normalMessagesNum'+i+'" >'+(i)+'</span>'
                +'                         <span class="messageCenterText messageCenterText0001 NormalMessagesTime NormalMessagesNum" id="normalMessagesTime'+(i)+'" >'+time+'</span>'
                +'                         <input type="text" id="normalMessagesInput'+(i)+'"  style="border: none" readonly="readonly"  value="'+message+'" class="messageCenterText messageCenterText0001 NormalMessagesText NormalMessagesNum" >'
                +'                         <button type="button" onclick="dangerSysMessageBtn(\''+arr+'\')" class="btn btn-danger"><span style="margin-top: 1px">删除</span></button>'
                +'                     </li>';
            $("#messageSidBar_ul0001").append(html)
        })









    })
}

function dangerSysMessageBtn(obj) {
    let strS = obj.split(",")
    let message = strS[0]
    let date = strS[1]
    let month = strS[2]
    let hour = strS[3]
    let messageType = strS[4]
    let liId = "card_Li01" + strS[5]
    console.log(liId)


    $.post("/messageCenter/sysMessageDelete", {
        message: message,
        date: date,
        month: month,
        hour: hour,
        messageType: messageType
    }, function (result) {
        if (result.flag) {
            gotoMessageCenter()
        }else {
            $("#messageCenterText0001").text(result.errorMsg)
            $("#messageCenterText0001").css("color","orange")
            setTimeout(function (){
                $("#messageCenterText0001").text("系统消息")
                $("#messageCenterText0001").css("color","rgb(255,255,255)")
            },3000)
        }
        messageCount()
    })
}

const duplicate2 = function(arr){
    let res={}
    arr.forEach(item=>{
        item.sort((a,b)=>a-b);
        res[item]=item;
    });
    return Object.values(res)
}